Skip to content

Support absolute include/exclude patterns in AbstractScanner - #380

Open
kwin wants to merge 3 commits into
masterfrom
kwin-scanner-absolute-patterns
Open

kwin wants to merge 3 commits into
masterfrom
kwin-scanner-absolute-patterns

Conversation

@kwin

@kwin kwin commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Maven built-in properties expose absolute paths, so callers currently have to strip them before passing them to the scanner.

When match patterns are set up, absolute patterns below the base directory are now made relative to it, and absolute patterns outside the base directory are silently ignored. Relative patterns and %regex[...] / %ant[...] patterns are unchanged. Javadoc of setIncludes/setExcludes is updated and DirectoryScannerTest.absolutePatterns covers includes and excludes.

Fixes: #379

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The path-prefix comparison mishandles dot-segment base directories such as /project/., silently dropping valid absolute patterns and causing incorrect include and exclude results.

1 open issue
What changed in this PR

This PR adds absolute include/exclude pattern support to AbstractScanner, allowing callers to pass Maven property paths without stripping the base directory.

Changes:

  • Converts absolute patterns below the base directory to relative patterns and ignores those outside it.
  • Preserves relative and %regex[...] / %ant[...] patterns.
  • Documents the behavior and adds include/exclude regression coverage.
File Description
src/​test/​java/​org/​codehaus/​plexus/​util/​DirectoryScannerTest.java Tests absolute include and exclude patterns.
src/​main/​java/​org/​codehaus/​plexus/​util/​AbstractScanner.java Adds absolute-pattern conversion and updates setter Javadoc.

Review effort: Balanced

@kwin kwin added the enhancement New feature or request label Nov 23, 2026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support absolute paths for AbstractScanner excludes/includes

2 participants